<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style>
		.text {
		  overflow: hidden;
		  display: -webkit-box;
		  -webkit-box-orient: vertical;
		  -webkit-line-clamp: 3; /* 显示三行文本 */
		}
		
		.hide {
		  display: none; /* 隐藏文本 */
		}
	</style>
	<body>
		
		<div class="content">
		  <p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus leo ex, luctus eget euismod eu, consectetur ac erat. Nulla lacinia tristique tempor.</p>
		  <button id="toggleButton">展开/收起</button>
		</div>
		
		<script>
			const toggleButton = document.getElementById('toggleButton');
			const text = document.querySelector('.text');
			
			toggleButton.addEventListener('click', function() {
			  if (text.classList.contains('hide')) {
			    text.classList.remove('hide');
			    toggleButton.textContent = '收起';
			  } else {
			    text.classList.add('hide');
			    toggleButton.textContent = '展开';
			  }
			});
			
		</script>
		
	</body>
</html>